var isLogin = false;



//打开index根据 localStorage 中的上次登录时间和保持登录的时间来判断是否需要重新登录
(function(){
  if(localStorage.getItem('date')&&localStorage.getItem('token')){
    var date = new Date();
    var lastDate = localStorage.getItem('date');
    var expires = localStorage.getItem('expires_in');
    if(date.getTime()>parseInt(lastDate)+(parseInt(expires)*1000)){
      clearToken();
      prompt("登录超时，请重新登录");
      window.location.href= '/login.html';
    }else{
      isLogin = true;
      localStorage.setItem('date',date.getTime());
    }
  }
})();


